package com.atstudy.jdbc;

import java.sql.Timestamp;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2023/1/11 10:05
 * @copyright: 博为峰
 */
public class DateUtils {
    public static Timestamp getTimestamp() {
        LocalDateTime localDateTime = LocalDateTime.now();
        ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
        Instant instant = zonedDateTime.toInstant();
        Date date = Date.from(instant);
        Timestamp timestamp = new Timestamp(date.getTime());
        return timestamp;
    }
}
